﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;

public partial class Users_RegisterResearch : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            
        }
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string studentInfo = txtStudent.Text.Trim();
        if (studentInfo != "")
        {
            DataTable dt = User_Control.getAllStudInfo();
            if (dt.Rows.Count > 0)
            {
                if (dt.Columns.Contains("StudStateCHN"))
                    dt.Columns.Remove("StudStateCHN");
                dt.Columns.Add("StudStateCHN");
                foreach (DataRow dr in dt.Rows)
                {
                    int state = int.Parse(dr["StudState"].ToString());
                    switch (state)
                    {
                        case 0:
                            dr["StudStateCHN"] = "已通过";
                            break;
                        case 1:
                            dr["StudStateCHN"] = "正在审核中";
                            break;
                    }
                }
                StringBuilder sb = new StringBuilder();
                sb.Append(" 1 = 1 ");
                sb.Append(" And( StudIdcard like '%" + studentInfo + "%' Or StudID like '%" + studentInfo + "%')");
                dt.DefaultView.RowFilter = sb.ToString();
                gv.DataSource = dt.DefaultView;
                gv.DataBind();
                if (gv.Rows.Count == 0)
                {
                    tips.Visible = true;
                    tips.Text = "未通过审核";
                }
            }
        }
        else
        {
            tips.Visible = true;
            tips.Text = "输入为空";
        }

    }
}